# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=tailspin
pkgver=3.0.0
pkgrel=0
pkgdesc="Log file highlighter"
url="https://github.com/bensadeh/tailspin"
arch="all !s390x" # nix crate fails to build
license="MIT"
depends="less"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/bensadeh/tailspin/archive/refs/tags/$pkgver.tar.gz"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/tspin -t "$pkgdir"/usr/bin/
	install -Dm644 man/tspin.1 -t "$pkgdir"/usr/share/man/man1/

	install -Dm644 completions/tspin.bash \
		"$pkgdir"/usr/share/bash-completion/completions/tspin
	install -Dm644 completions/tspin.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/tspin.fish
	install -Dm644 completions/tspin.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_tspin
}

sha512sums="
0f079d777fcb446b3b9b20b6d15974274f8f2ff4335bedbec1e3801561d6bc5b29c19a90d792ba88ba76e668e154f109479b9b73b11c5c50a388af8bf7b7e7ad  tailspin-3.0.0.tar.gz
"
